/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.base;

import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;

class Tokenizer {
	public String[] uniqueTokens(String string, String delimiter) {
		List<String> tokens = new LinkedList<String>();

		StringTokenizer stringTokenizer = new StringTokenizer(string, delimiter);

		while (stringTokenizer.hasMoreTokens()) {
			String token = stringTokenizer.nextToken();

			if (!tokens.contains(token)) {
				tokens.add(token);
			}
		}

		return tokens.toArray(new String[tokens.size()]);
	}
}